package com.boomsecret.list;

import com.boomsecret.bean.PageCondition;
import com.boomsecret.utils.PageUtils;

import java.util.Arrays;
import java.util.List;

/**
 * @author wangjinliang on 2018/12/3.
 */
public class SubList {

    public static void main(String[] args) {
        List<Long> ids = Arrays.asList(1L, 3L, 5L, 6L, 8L);
        PageCondition pageCondition = new PageCondition();
        pageCondition.setPageSize(2);

        for (int pageNum = 1; ;pageNum ++) {
            pageCondition.setPageNum(pageNum);
            List<Long> pageList = PageUtils.getListByPageCondition(ids, pageCondition);
            System.out.println(pageList.toString());

            if (pageList.size() != pageCondition.getPageSize()) {
                break;
            }
        }
    }
}
